 <!-- js placed at the end of the document so the pages load faster -->

    <script src="<%=constant.STATIC_PATH%>/assets/js/jquery.scrollTo.min.js"></script>
    <script src="<%=constant.STATIC_PATH%>/assets/js/jquery.nicescroll.js" type="text/javascript"></script>


    <!--common script for all pages-->
    <script src="<%=constant.STATIC_PATH%>/theme/<%= constant.SelectTheme %>/js/common-scripts.js"></script>

<script type="text/javascript">
    function showErrorMessage(msg, ctrl){
        addErrorMessagePanel();
        $("#errorMessagePanel").fadeIn().show().delay(3000).fadeOut();
        $("#errorMessage").html(msg);

        if(ctrl){
            $("#"+ctrl).css("border-color","#E04442");

            setTimeout(function(){
                $("#"+ctrl).css("border-color","#ccc");
            }, 3000);
        }
    }
    function addErrorMessagePanel(){
        if($("#errorMessagePanel").length>0){
            return;
        }
        
        var htmlStr = '<div class="alert alert-block alert-danger fade in" id="errorMessagePanel" style="display:none">';
        htmlStr += '    <button data-dismiss="alert" class="close close-sm" type="button">';
        htmlStr += '        <i class="fa fa-remove"></i>';
        htmlStr += '    </button>';
        htmlStr += '    <span id="errorMessage"></span>';
        htmlStr += '</div>';
        $('.form-group').last().children('div').append(htmlStr);
    }

    function showSuccessMessage(msg, delay){
        addSuccessMessagePanel();
        
        if(typeof(delay) == 'undefined' || isNaN(delay)){
            $("#successMessagePanel").fadeIn().show().delay(3000).fadeOut();
        }
        else if(delay > 0){
            $("#successMessagePanel").fadeIn().show().delay(delay).fadeOut();
        }
        else{
            $("#successMessagePanel").fadeIn().show();
        }
        
        $("#successMessage").html(msg);
    }
    function addSuccessMessagePanel(){
        if($("#successMessagePanel").length>0){
            return;
        }
        
        var htmlStr = '<div class="alert alert-block alert-success fade in" id="successMessagePanel" style="display:none">';
        htmlStr += '    <button data-dismiss="alert" class="close close-sm" type="button">';
        htmlStr += '        <i class="fa fa-remove"></i>';
        htmlStr += '    </button>';
        htmlStr += '    <span id="successMessage"></span>';
        htmlStr += '</div>';
        $('.form-group').last().children('div').append(htmlStr);
    }
</script>